package com.common.baselibrary.utils;

public class EffectiveClick {

    static long MAX_CLICK_SPAN = 1 * 1000;

    public static EffectiveClick create() {
        return new EffectiveClick();
    }

    private long lastClickTime = 0;
    private long maxClickSpan = MAX_CLICK_SPAN;

    private EffectiveClick() {
    }

    public boolean isEffectiveClick() {
        if (Math.abs(System.currentTimeMillis() - lastClickTime) <= maxClickSpan) {
            return true;
        }
        lastClickTime = System.currentTimeMillis();
        return false;
    }

    public void setMaxClickSpan(long maxClickSpan) {
        this.maxClickSpan = maxClickSpan;
    }

}
